// import BMap from 'BMap';
// import BMapSymbolSHAPEPOINT from 'BMap_Symbol_SHAPE_POINT';
define([
    './custom/widgets/js/yufpOrgTree.js',
    './custom/widgets/js/yufpExtTree.js',
    'libs/echarts/newecharts/echarts.min.js'
], function (require, exports) {
    // page加载完成后调用ready方法
    exports.ready = function (hashCode, data, cite) {
        yufp.custom.vue({
            el: '#map2',
            data: function () {
                var me = this;
                return {
                    map1: null,
                    map2: null,
                    flag: true,
                    drawingManager: null,
                    cityName: '',
                    custCvr: '',
                    gridCustNum: '',
                    custNum: '',
                    loanBal: '',
                    fincBal: '',
                    depBal: '',
                    gridName: '',
                    polygon: null,
                    configType: 'CREATE',
                    gridVisible: false,
                    createGridFormdata: {},
                    custNumData: [],
                    custNumDataValue: [],
                    custNumDataValueAUM: [],
                    custNumDataQs: [],
                    custNumDataQsValue: [],
                    custNumDataDepValue: [],
                    createFormdata: {},
                    configdialogVisible: false,
                    chooseGridVisible: false,
                    GridTab: true, // 网格地图划分
                    GridInfoTab: true, // 网格信息配置
                    chooseGridFormdata: {},
                    activeNames: ['1'],
                    activeNames2: ['2'],
                    activeName3: 'first',
                    popoverWidth: document.getElementById('allmapGeneral').clientHeight*0.6,
                    visible: false,
                    tabLabelDic: {
                        first: 1,
                        second: 2,
                        third: 3,
                        fourth: 4,
                        fifth: 5,
                        sixth: 6,
                        seventh: 7
                    },//字典对应值
                    visibleBUD: false,
                    markPolygonInfo: [],
                    nowNode: '', // 当前选中节点数据
                    heightOrg: yufp.custom.viewSize().height - 152,
                    treeUrlRel: backend.appOcaService + '/api/util/getorg',
                    dataRoot: {orgId: yufp.session.org.id, orgName: yufp.session.org.name},
                    styleOptions: {
                        strokeColor: "#1a1aff",    //边线颜色。
                        fillColor: "",      //填充颜色。当参数为空时，圆形将没有填充效果。
                        strokeWeight: 3,       //边线的宽度，以像素为单位。
                        strokeOpacity: 0.8,	   //边线透明度，取值范围0 - 1。
                        fillOpacity: 0.6,      //填充的透明度，取值范围0 - 1。
                        strokeStyle: 'solid' //边线的样式，solid或dashed。
                    },
                    styleOptionsLevel2: {
                        strokeColor: "#009900",    //边线颜色。
                        fillColor: "",      //填充颜色。当参数为空时，圆形将没有填充效果。
                        strokeWeight: 3,       //边线的宽度，以像素为单位。
                        strokeOpacity: 0.8,	   //边线透明度，取值范围0 - 1。
                        fillOpacity: 0.6,      //填充的透明度，取值范围0 - 1。
                        strokeStyle: 'dashed' //边线的样式，solid或dashed。
                    },
                    dataParams: {orgSts: 'A', lazy: true},
                    // barOption: {
                    //     xAxis: {
                    //         type: 'category',
                    //         data: this.custNumData //['网格一', '网格二', '网格三', '网格四']
                    //     },
                    //     yAxis: {
                    //         type: 'value',
                    //         scale: true
                    //     },
                    //     series: [{
                    //         data: this.custNumDataValue, //[4123, 5012, 6399, 2301],
                    //         type: 'bar',
                    //         showBackground: true,
                    //         barWidth: 30,//柱图宽度
                    //         backgroundStyle: {
                    //             color: 'rgba(180, 180, 180, 0.2)'
                    //         },
                    //         itemStyle: {
                    //             normal: {
                    //                 color: function (params) {
                    //                     var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                    //                     return colorlist[params.dataIndex];
                    //                 }
                    //             }
                    //         }
                    //     }]
                    // },
                    // barOptionAUM: {
                    //     xAxis: {
                    //         type: 'category',
                    //         data: ['1', '2', '3', '4']
                    //     },
                    //     yAxis: {
                    //         type: 'value',
                    //         scale: true
                    //     },
                    //     series: [{
                    //         data: [8.5, 10, 6.3, 5.6],
                    //         type: 'bar',
                    //         showBackground: true,
                    //         barWidth: 40,//柱图宽度
                    //         backgroundStyle: {
                    //             color: 'rgba(180, 180, 180, 0.2)'
                    //         },
                    //         itemStyle: {
                    //             normal: {
                    //                 color: function (params) {
                    //                     var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                    //                     return colorlist[params.dataIndex];
                    //                 }
                    //             }
                    //         },
                    //         markLine: {
                    //             itemStyle: {
                    //                 normal: {
                    //                     color: '#FA8565',
                    //                     label: {
                    //                         formatter: '{b} {c}'
                    //                     }
                    //                 }
                    //             },
                    //             data: [
                    //                 {
                    //                     name: '目标值',
                    //                     yAxis: 8.5
                    //                 }
                    //             ]
                    //         }
                    //     }]
                    // },
                    // categoryOption: {
                    //     tooltip: {
                    //         trigger: 'axis'
                    //     },
                    //     legend: {
                    //         data: ['平均数']
                    //     },
                    //     xAxis: {
                    //         type: 'category',
                    //         boundaryGap: false,
                    //         data: ['01/01', '01/02', '01/03', '01/04', '01/05', '01/06', '01/07', '01/08', '01/09', '01/10', '01/11', '01/12', '01/13', '01/14', '01/15', '01/16', '01/17', '01/18']
                    //     },
                    //     yAxis: {
                    //         type: 'value'
                    //     },
                    //     series: [{
                    //         name: '平均值:',
                    //         data: [3, 7, 14, 16, 20, 21, 24, 27, 25, 12.3, 10, 11, 6, 14.5, 13, 16, 14.5, 20],
                    //         type: 'line'
                    //     }]
                    // },
                    // shadowOption: {
                    //     tooltip: {
                    //         trigger: 'axis',
                    //         axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                    //             type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    //         }
                    //     },
                    //     // grid: {
                    //     //     left: '3%',
                    //     //     right: '4%',
                    //     //     bottom: '3%',
                    //     //     containLabel: true
                    //     // },
                    //     xAxis: [
                    //         {
                    //             type: 'category',
                    //             data: ['01/01', '01/02', '01/03', '01/04', '01/05', '01/06', '01/07', '01/08', '01/09', '01/10', '01/11', '01/12', '01/13', '01/14', '01/15', '01/16', '01/17', '01/18'],
                    //             axisTick: {
                    //                 alignWithLabel: true
                    //             }
                    //         }
                    //     ],
                    //     yAxis: [
                    //         {
                    //             type: 'value'
                    //         }
                    //     ],
                    //     series: [
                    //         {
                    //             name: '平均值:',
                    //             type: 'bar',
                    //             barWidth: '60%',
                    //             data: [3, 7, 14, 16, 20, 21, 24, 27, 25, 12.3, 10, 11, 6, 14.5, 13, 16, 14.5, 20],
                    //         }
                    //     ]
                    // },
                    tabName: 'first',
                    rules: {
                        gridName: [
                            {required: true, message: '必填项', trigger: 'blur'}
                        ],
                        scenePro: [
                            {required: true, message: '必填项', trigger: 'blur'}
                        ],
                        buildName: [
                            {required: true, message: '必填项', trigger: 'blur'}
                        ],
                        longitude: [
                            {required: true, message: '必填项', trigger: 'blur'}
                        ],
                        latitude: [
                            {required: true, message: '必填项', trigger: 'blur'}
                        ]
                    },
                };
            },
            mounted() {
                this.tabName = this.GridTab ? 'first' : (this.GridInfoTab ? 'second' : '');
                // 百度地图API功能
                map1 = new BMap.Map("allmapGeneral");    // 创建Map实例
                map1.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
                //添加地图类型控件
                map1.addControl(new BMap.MapTypeControl({
                    mapTypes: [
                        BMAP_NORMAL_MAP,
                        BMAP_HYBRID_MAP
                    ]
                }));
                map1.setCurrentCity("南京");          // 设置地图显示的城市 此项是必须设置的
                map1.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
                // var point = new BMap.Point(116.331398,39.897445);
                // map1.centerAndZoom(point,12);
                //
                // function myFun(result){
                //     var cityName = result.name;
                //     map1.setCenter(cityName);
                //     // alert("当前定位城市:"+cityName);
                // }
                // var myCity = new BMap.LocalCity();
                // myCity.get(myFun);

                // let myChart = document.getElementById("myChart");
                // myChart.style.width = window.innerWidth - 290 + "px";  //初始化echarts图表宽度
                // // this.myChart = this.$echarts.init(myChart);
                // // this.myChart.setOption(this.echarts_option1);
                // // let self = this;
                // window.addEventListener("resize", () => {  // 通过resize方法来重设图表宽度
                //     let myChart = document.getElementById("myChart");
                //     myChart.style.width = window.innerWidth - 290 + "px";
                //     // myChart.css('width', myChart.style.width);
                // });
                // myChart.css('width', myChart);
                // myChart.css('height', myChart);
                map2 = new BMap.Map("allmapGenera2");    // 创建Map实例
                map2.centerAndZoom(new BMap.Point(116.404, 39.915), 11);  // 初始化地图,设置中心点坐标和地图级别
                // //添加地图类型控件
                map2.addControl(new BMap.MapTypeControl({
                    mapTypes: [
                        BMAP_NORMAL_MAP,
                        BMAP_HYBRID_MAP
                    ]
                }));
                map2.setCurrentCity("南京");          // 设置地图显示的城市 此项是必须设置的
                map2.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
                // var point = new BMap.Point(116.331398,39.897445);
                // map2.centerAndZoom(point,12);
                //
                // function myFun1(result){
                //     var cityName = result.name;
                //     map2.setCenter(cityName);
                //     // alert("当前定位城市:"+cityName);
                // }
                // var myCity1 = new BMap.LocalCity();
                // myCity1.get(myFun1);
                this.requestThird(yufp.session.userId, "1");//进入页签默认加载社区网格和建筑物点

                // document.addEventListener('visibilitychange', function() {
                //     // 页面变为不可见时触发
                //     if (document.visibilityState == 'hidden') {
                //         document.title = '离开';
                //         this.visible = false;
                //     }
                //     // 页面变为可见时触发
                //     if (document.visibilityState == 'visible') {
                //         document.title = '回来';
                //     }
                // });
                this.popoverWidth=document.body.clientWidth*0.6;
            },
            methods: {
                // beforeunloadFn (e) {
                //     this.visible = false;
                // },
                theLocation: function () {
                    console.info("KKKKKKKKKKKK")
                    // var city = document.getElementById("cityName").value;
                    if (this.cityName != "") {
                        this.analysis(this.cityName);      // 用城市名设置地图中心点
                    }
                },
                handleChange: function (val) {
                    console.log(val);
                },
                handleChange2: function (val) {
                    console.log(val);
                },
                nodeClickFn: function (node, obj, nodeComp) {
                    var _this = this;
                    if (node != '') {
                        this.nowNode = node;
                        // console.info(node);
                        // console.info(this.nowNode);
                        // console.info(this.nowNode.orgLevel);
                        if (this.nowNode.orgLevel == '3' || (this.nowNode.orgLevel == undefined && (this.nowNode.orgId != '000000000' &&
                            this.nowNode.orgId != '100000000' && this.nowNode.orgId != '200000000' && this.nowNode.orgId != '300000000' && this.nowNode.orgId != '400000000' &&
                            this.nowNode.orgId != '500000000' && this.nowNode.orgId != '600000000' && this.nowNode.orgId != '700000000' && this.nowNode.orgId != '800000000' && this.nowNode.orgId != '900000000'))) {//叶子结点
                            var level = '';
                            if (yufp.session.roles[0].code == 'R0001' || yufp.session.roles[0].code == 'R0002') {
                                level = '3';
                            }
                            //查询该支行网格信息
                            yufp.service.request({
                                url: backend.msmFrontWebService + '/api/gridGeneral/oneLevelGrid',
                                method: 'get',
                                // data: JSON.stringify(array),
                                data: {
                                    condition: JSON.stringify({
                                        orgId: this.nowNode.orgId,
                                        userId: yufp.session.userId,
                                        level: level
                                    })
                                },
                                callback: function (code, message, response) {

                                    if (code == 0 && response.code == 0) {
                                        _this.initLatLng1(response.data, map1);//构建一级网格并存储相关信息

                                        console.info(response.data);//获取到一级网格点的信息
                                        console.info("成功");
                                    } else {
                                        console.info("失败");
                                    }
                                }
                            });
                            console.info("this.showPolygon();");

                            // this.showPolygon();
                        }
                    }
                },
                // showMarkDio: function (){
                //   this.configType = 'CREATEB';
                //   this.configdialogVisible = true;
                //   this.$nextTick(function () {
                //     this.$refs.configform.resetFields();
                //     yufp.extend(this.$refs.configform.formModel, this.bizModel);
                //   });
                // },
                initDrawingManager: function (flag) {
                    var _this = this;
                    var styleOptions = {
                        strokeColor: "red",    //边线颜色。
                        fillColor: "red",      //填充颜色。当参数为空时，圆形将没有填充效果。
                        strokeWeight: 3,       //边线的宽度，以像素为单位。
                        strokeOpacity: 0.8,	   //边线透明度，取值范围0 - 1。
                        fillOpacity: 0.6,      //填充的透明度，取值范围0 - 1。
                        strokeStyle: 'solid' //边线的样式，solid或dashed。
                    }
                    //实例化鼠标绘制工具
                    // console.info(!this.drawingManager);
                    if (!this.drawingManager) {
                        this.drawingManager = new BMapLib.DrawingManager(map, {
                            isOpen: true, //是否开启绘制模式
                            enableDrawingTool: flag, //是否显示工具栏
                            drawingMode: BMAP_DRAWING_POLYGON,//绘制模式  多边形
                            drawingToolOptions: {
                                anchor: BMAP_ANCHOR_TOP_RIGHT, //位置
                                offset: new BMap.Size(100, 10), //偏离值
                                drawingModes: [
                                    BMAP_DRAWING_MARKER,
                                    BMAP_DRAWING_POLYGON
                                ]
                            },
                            // circleOptions: styleOptions, //圆的样式
                            // polylineOptions: styleOptions, //线的样式
                            polygonOptions: styleOptions, //多边形的样式
                            // rectangleOptions: styleOptions //矩形的样式
                        });
                    }//else{

                    // console.info(this.drawingManager._drawingTool)
                    // delete this.drawingManager._drawingTool;
                    //}

                    // drawingManager.close();
                    // drawingManager.hidden();
                    //添加鼠标绘制工具监听事件，用于获取绘制结果
                    // var overlays = [];
                    var polygoncomplete = function (e) {
                        console.log(e);
                        // console.log(e.type);
                        // console.log(e.point);
                        // if(e.type=='markercomplete'){
                        //   console.log(e.point);
                        // }else{
                        //   overlays.push(e.overlay);
                        _this.gridVisible = true;
                        var path = e.Ao;//Array<Point> 返回多边型的点数组
                        var lngLsit = "";
                        var latLsit = "";
                        for (var i = 0; i < path.length; i++) {
                            if (i > 0) {
                                lngLsit += ',';
                                latLsit += ',';
                            }
                            latLsit += path[i].lat;
                            lngLsit += path[i].lng;
                            // console.log("lng:"+path[i].lng+"\n lat:"+path[i].lat);
                        }
                        console.log("lng:" + lngLsit + "\n lat:" + latLsit);
                        _this.createGridFormdata.longitude = lngLsit;
                        _this.createGridFormdata.latitude = latLsit;
                        // }
                    };
                    var markercomplete = function (e) {
                        // showMarkDio();
                        // _this.configType = 'CREATEB';
                        _this.configdialogVisible = true;
                        console.info("_this.configdialogVisible");
                        console.info(_this.configdialogVisible);
                        console.info("_this.configdialogVisible end");
                        console.log(e);
                        console.log(e.type);
                        console.log(e.point);
                        _this.createFormdata.longitude = e.point.lng;
                        _this.createFormdata.latitude = e.point.lat;
                    };
                    // function showMarkDio(){
                    // this.configType = 'CREATEB';

                    //  this.$nextTick(function () {
                    //   this.$refs.configform.resetFields();
                    //   yufp.extend(this.$refs.configform.formModel, this.bizModel);
                    // });
                    // };
                    // this.drawingManager.addEventListener('polygoncomplete', overlaycomplete);
                    this.drawingManager.addEventListener('polygoncomplete', polygoncomplete);
                    this.drawingManager.addEventListener('markercomplete', markercomplete);
                },
                showTool: function () { //根据点绘制多边形方法
                    this.removeOverlay();
                    this.initDrawingManager(this.flag);
                    // this.initDrawingManager(this.flag);
                    // // overlays.push(polygon); //是否把该图像加入到编辑和删除行列
                    // // btn.setAttribute('disabled','false');
                    // showText();
                },
                analysis: function (addressMap) {
                    // //创建地址解析器实例
                    // var myGeo = new BMap.Geocoder();
                    // // 将地址解析结果显示在地图上，并调整地图视野
                    // myGeo.getPoint(address, function(point){
                    //     if(point){
                    //         map.centerAndZoom(point, 14);
                    //         map.addOverlay(new BMap.Marker(point, {title: address}))
                    //     }else{
                    //         alert('您选择的地址没有解析到结果！');
                    //     }
                    // }, address)
                    var local = new BMap.LocalSearch(map1, {
                        //智能搜索
                        onSearchComplete: function () {
                            var j = local.getResults().getPoi(0).point.lng //获取第一个智能搜索的结果
                            var w = local.getResults().getPoi(0).point.lat //获取第一个智能搜索的结果
                            // console.log(j + '-' + w)
                            var a = map1.panTo(new BMap.Point(j, w)) //地图中心点转移到第一条搜索结果
                            // var mPoint = new BMap.Point((j, w), 20)
                            var marker1 = new BMap.Marker(new BMap.Point(j, w)) // 创建标注
                            map1.clearOverlays()
                            map1.addOverlay(marker1) // 将标注添加到地图
                            marker1.onclick = function () {
                                window.open(
                                    'http://api.map.baidu.com/geocoder?address=' +
                                    addressMap +
                                    '&output=html&src=webapp.baidu.openAPIdemo'
                                )
                            }
                        },
                    })
                    local.enableAutoViewport(true);
                    local.search(addressMap);

                },
                editPolygon: function () { //根据点绘制多边形方法并可编辑返回修改后的点
                    this.flag = false;
                    console.info("this.flag::::::" + this.flag);
                    console.info(this.drawingManager);
                    this.removeOverlay();
                    this.chooseGridVisible = true;
                    var styleOptions = {
                        strokeColor: "#1a1aff",    //边线颜色。
                        fillColor: "",      //填充颜色。当参数为空时，圆形将没有填充效果。
                        strokeWeight: 3,       //边线的宽度，以像素为单位。
                        strokeOpacity: 0.8,	   //边线透明度，取值范围0 - 1。
                        fillOpacity: 0.6,      //填充的透明度，取值范围0 - 1。
                        strokeStyle: 'solid' //边线的样式，solid或dashed。
                    };
                    // 百度坐标系坐标(地图中需要使用这个)
                    var bPoints = new Array();
                    //后台数据
                    var data_info = [
                        [116.70410590477336, 39.79979372793364],
                        [115.97971234152713, 39.56701661452678],
                        [115.96361470678833, 39.01661208380118],
                        [116.96166806059423, 39.44765708787029],
                        [116, 39]
                    ];
                    for (var i = 0; i < data_info.length; i++) {
                        var point = new BMap.Point(data_info[i][0], data_info[i][1]); //将标注点转化成地图上的点
                        bPoints.push(point); // 添加到百度坐标数组 用于自动调整缩放级别
                        // var marker = new BMap.Marker(point);  // 创建标注
                        // var content = data_info[i][2];
                        // map.addOverlay(marker);               // 将标注添加到地图中
                        // addClickHandler(content,marker);
                    }

                    this.setZoom(bPoints);//自动定位
                    this.polygon = new BMap.Polygon(bPoints, styleOptions);  //创建多边形
                    this.InOrOutPolygon(116.70410590477336, 39.79979372793364, this.polygon);
                    // this.polygon = new BMap.Polygon([
                    //   new BMap.Point(115.97971234152713,39.56701661452678),
                    //   new BMap.Point(115.96361470678833,39.01661208380118),
                    //   new BMap.Point(116.96166806059423,39.44765708787029),
                    //   new BMap.Point(116.70410590477336,39.79979372793364),
                    //   new BMap.Point(116,39)
                    // ], styleOptions);  //创建多边形
                    map1.addOverlay(this.polygon);   //增加多边形
                    this.polygon.enableEditing();
                    var lineupdate = function (e) {
                        var path = e.target.Ao;//Array<Point> 返回多边型的点数组
                        for (var i = 0; i < path.length; i++) {
                            console.log("lng:" + path[i].lng + "\n lat:" + path[i].lat);
                        }
                    };
                    this.polygon.addEventListener('lineupdate', lineupdate);
                },
                showPolygon: function () { //根据点绘制多边形方法    点击机构树支行节点时调用
                    this.removeOverlay();
                    var styleOptions = {
                        strokeColor: "#1a1aff",    //边线颜色。
                        fillColor: "",      //填充颜色。当参数为空时，圆形将没有填充效果。
                        strokeWeight: 3,       //边线的宽度，以像素为单位。
                        strokeOpacity: 0.8,	   //边线透明度，取值范围0 - 1。
                        fillOpacity: 0.6,      //填充的透明度，取值范围0 - 1。
                        strokeStyle: 'solid' //边线的样式，solid或dashed。
                    };
                    // 百度坐标系坐标(地图中需要使用这个)
                    var bPoints = new Array();
                    //后台数据
                    var data_info = [
                        [116.70410590477336, 39.79979372793364],
                        [115.97971234152713, 39.56701661452678],
                        [115.96361470678833, 39.01661208380118],
                        [116.96166806059423, 39.44765708787029],
                        [116, 39]
                    ];
                    for (var i = 0; i < data_info.length; i++) {
                        var point = new BMap.Point(data_info[i][0], data_info[i][1]); //将标注点转化成地图上的点
                        bPoints.push(point); // 添加到百度坐标数组 用于自动调整缩放级别
                    }

                    this.setZoom(bPoints);//自动定位
                    this.polygon = new BMap.Polygon(bPoints, styleOptions);  //创建多边形

                    map1.addOverlay(this.polygon);   //增加多边形

                    //markPolygonInfo记录查询多边形结果和相关信息的映射,用于点击事件的查询条件存储
                    //循环存储对象的形式,后续判断:通过遍历点相等来确定多边形id


                },
                removeOverlay: function () {
                    map1.clearOverlays();
                },
                sureConfig: function () {
                },
                getZoom: function (list) {
                    var point0 = new BMap.Point(list[0].lon, list[0].lat);
                    var maxDistance = 0;
                    for (var i = 1; i < list.length; i++) {
                        var pointX = new BMap.Point(list[i].lon, list[i].lat);
                        var distance = map1.getDistance(point0, pointX).toFixed(1);
                        if (distance > maxDistance) {
                            maxDistance = distance
                        }
                    }
                    maxDistance = maxDistance * 2;//计算距离中心点最远点和中心点距离的2倍
                    var zoom = ["50", "100", "200", "500", "1000", "2000", "5000", "10000", "20000", "25000", "50000", "100000", "200000", "500000", "1000000", "2000000"]//级别18到3。
                    // var pointA = new BMap.Point(maxLng,maxLat);  // 创建点坐标A
                    // var pointB = new BMap.Point(minLng,minLat);  // 创建点坐标B
                    // var distance = map.getDistance(pointA,pointB).toFixed(1);  //获取两点距离,保留小数点后两位
                    for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) {
                        if (zoom[i] - distance > 0) {
                            return 18 - i;//之所以会多3，是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。
                        }
                    }
                    ;
                },
                // 根据点的数组自动调整缩放级别
                setZoom: function (bPoints) {
                    var view = map1.getViewport(eval(bPoints));
                    var mapZoom = view.zoom;
                    var centerPoint = view.center;
                    map1.centerAndZoom(centerPoint, mapZoom);
                },
                /**
                 * 判断两多变形是否存在点与区域的包含关系(A的点在B的区域内或B的点在A的区域内)
                 */
                // isPointInPolygonBidirectional: function (plyA, plyB) {
                //   const [pA, pB] = [[], []];
                //   plyA.forEach((item) => {
                //       pA.push(new BMap.Point(item.lng, item.lat));
                //   });
                //   plyB.forEach((item) => {
                //       pB.push(new BMap.Point(item.lng, item.lat));
                //   });
                //   let [a, b] = [false, false];
                //   a = pA.some(item => BMapLib.GeoUtils.isPointInPolygon(item, new BMap.Polygon(pB)));
                //   if (!a) {
                //       b = pB.some(item => BMapLib.GeoUtils.isPointInPolygon(item, new BMap.Polygon(pA)));
                //   }
                //   return a || b;
                // },
                /**
                 * 判断点是否在区域内
                 */
                InOrOutPolygon: function (lng, lat, ply) {
                    var pt = new BMap.Point(lng, lat);
                    var result = BMapLib.GeoUtils.isPointInPolygon(pt, ply);
                    if (result == true) {
                        console.info("3333333333333333 :   " + "在区域范围内");
                    } else {
                        console.info("3333333333333333 :   " + "在区域范围外");
                    }
                },
                handleClick: function () {
                    this.visibleBUD = false;
                    this.visible = false;
                },
                //建筑网格默认以社区进行查询
                handleClick3: function (tab, event) {
                    console.log(tab, event);
                    console.log(tab.name);
                    console.log(this.tabLabelDic[tab.name]);
                    console.log(yufp.session.userId);
                    map2.clearOverlays();
                    this.requestThird(yufp.session.userId, this.tabLabelDic[tab.name]);
                },
                //请求thirdLevelGrid
                requestThird: function (userId, type) {
                    var _this = this;
                    yufp.service.request({
                        url: backend.msmFrontWebService + '/api/gridGeneral/thirdLevelGrid',
                        method: 'get',
                        // data: JSON.stringify(array),
                        data: {
                            condition: JSON.stringify({
                                userId: userId,
                                gridSceneType: type
                            })
                        },
                        callback: function (code, message, response) {
                            if (code == 0 && response.code == 0) {
                                _this.initLatLng1(response.data, map2);//构建二级网格及下面的建筑物
                                console.info("成功");
                            } else {
                                console.info("失败");
                            }
                        }
                    });
                },
                // 添加地图点击事件
                addMapEvent: function () {
                    map.addEventListener('click', showInfo);
                },
                // 移除地图点击事件
                removeMapEvent: function () {
                    map.removeEventListener('click', showInfo);
                },
                //解析一级网格后台经纬度 并添加到地图
                initLatLng1: function (data, map) {
                    this.removeOverlay();
                    this.markPolygonInfo = [];
                    for (let i = 0; i < data.length; i++) {
                        //如果是建筑物点就执行下面逻辑并break掉
                        console.info("------------------------------");
                        console.info(data[i].gridlevel);
                        console.info("------------------------------");
                        if (data[i].gridlevel == "3") {//对点进行操作
                            console.info("进入data[i].gridlevel == \"3\"");//获取到一级网格点的信息
                            var pointD = new BMap.Point(data[i].longitude, data[i].latitude);
                            map.centerAndZoom(pointD, 13);
                            // 创建点标记
                            var marker = new BMap.Marker(pointD);
                            this.addListeThird(marker);
                            map.addOverlay(marker);
                            //点击弹出信息
                            marker.addEventListener(
                                "click",
                                function () {
                                    var sContent =
                                        "<form method=\'post\' action=\'\'>" +
                                        "<table>" +
                                        "<tr>" +
                                        "<td><b>名称：</b>" +
                                        "<input type=\'text\' name=\'Name\' style=\'margin-top:10px;width:150px\' value=" + data[i].gridname + ">" +
                                        "</td><tr></tr>";
                                    sContent += "</tr>" +
                                        "</talbe>" +
                                        "</form>";
                                    var opts = {
                                        enableMessage: false
                                    };
                                    var infoWindow = new BMap.InfoWindow(sContent, opts);
                                    this.openInfoWindow(infoWindow);
                                });
                            continue;
                        }
                        var latitude = data[i].latitude.split(",");
                        var longitude = data[i].longitude.split(",");
                        var bPoints = new Array();

                        for (let j = 0; j < latitude.length; j++) {
                            // 百度坐标系坐标(地图中需要使用这个)
                            var point = new BMap.Point(longitude[j], latitude[j]); //将标注点转化成地图上的点
                            bPoints.push(point); // 添加到百度坐标数组 用于自动调整缩放级别
                            // var marker = new BMap.Marker(point);  // 创建标注
                            // var content = data_info[i][2];
                            // map.addOverlay(marker);               // 将标注添加到地图中
                            // addClickHandler(content,marker);
                        }


                        this.setZoom(bPoints);//自动定位
                        if (data[i].gridlevel == "1") {
                            polygon = new BMap.Polygon(bPoints, this.styleOptions);  //创建多边形
                        } else {
                            polygon = new BMap.Polygon(bPoints, this.styleOptionsLevel2);  //创建多边形
                        }

                        // var polygon = new BMap.Polygon(bPoints, this.styleOptions);  //创建多边形

                        //获取多边形中间点---------------------------
                        var x = 0,
                            y = 0;
                        var path = polygon.getPath();//返回多边型的点数组；ply是多边形覆盖物
                        for (var k = 0; k < path.length; k++) {
                            x = x + parseFloat(path[k].lng);
                            y = y + parseFloat(path[k].lat);
                        }
                        x = x / path.length;
                        y = y / path.length;
                        //获取多边形中间点---------------------------

                        //添加标签----------------------------------------
                        // var tagMarkerIcon = new BMap.Icon("http://api.map.baidu.com/img/markers.png", new BMap.Size(23, 25), {
                        var tagMarkerIcon = new BMap.Icon("http://192.168.55.58:8081/api.map.baidu.com/img/markers.png", new BMap.Size(23, 25), {
                            imageOffset: new BMap.Size(0, 0 - 13 * 25) // 设置图片偏移
                        });
                        var marker1 = new BMap.Marker(new BMap.Point(x, y), {icon: tagMarkerIcon});
                        var label1 = new BMap.Label(data[i].gridname, {offset: new BMap.Size(-15, 2)});
                        marker1.setLabel(label1);
                        label1.setStyle({
                            color: "red",
                            fontSize: "9px",
                            backgroundColor: "0.05",
                            border: "1",
                            fontWeight: "bold",
                            borderStyle: "solid"
                        });
                        //点击弹出信息
                        marker1.addEventListener(
                            "click",
                            function () {
                                var sContent =
                                    "<form method=\'post\' action=\'\'>" +
                                    "<table>" +
                                    "<tr>" +
                                    "<td><b>名称：</b>" +
                                    "<input type=\'text\' name=\'Name\' style=\'margin-top:10px;width:150px\' value=" + data[i].gridname + ">" +
                                    "</td>" +
                                    "</tr>" +
                                    "</talbe>" +
                                    "</form>";
                                var opts = {
                                    enableMessage: false
                                };
                                var infoWindow = new BMap.InfoWindow(sContent, opts);
                                this.openInfoWindow(infoWindow);
                            });
                        map.addOverlay(marker1);
                        //添加标签----------------------------------------

                        polygon.setFillOpacity(0.5 + (i + 1) * 0.00001);
                        var obj = new Object();
                        obj = data[i];
                        obj.fillOpacity = 0.5 + (i + 1) * 0.00001;
                        // console.info("obj");
                        // console.info(obj);
                        this.markPolygonInfo.push(obj)
                        console.info(this.markPolygonInfo);
                        if (obj.gridlevel == "1") {
                            this.addListe(polygon);
                        } else {
                            this.addListeTwo(polygon);
                        }
                        map.addOverlay(polygon);
                    }
                },
                //给一级多边形添加事件
                addListe: function (polygon) {
                    // 批量绑定事件
                    var clickEvts = ['click', 'rightclick'];
                    var moveEvts = ['mouseover', 'mouseout'];
                    // var overlays = [marker, polyline, polygon, circle];
                    var this1 = this;
                    for (var i = 0; i < clickEvts.length; i++) {
                        const event = clickEvts[i];
                        // for (let j = 0; j < overlays.length; j++) {
                        //     const overlay = overlays[j];
                        polygon.addEventListener(event, e => {
                            switch (event) {
                                case 'click':
                                    //点击进行二级网格的查询展示
                                    console.info(e.target.getFillOpacity());
                                    for (var j = 0; j < this.markPolygonInfo.length; j++) {
                                        if (this.markPolygonInfo[j].fillOpacity == e.target.getFillOpacity()) {
                                            console.info("点击进行二级网格的查询展示")
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/twoLevelGrid',
                                                method: 'get',
                                                // data: JSON.stringify(array),
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    if (code == 0 && response.code == 0) {
                                                        this1.initLatLng1(response.data, map1);//构建一级网格并存储相关信息

                                                        console.info(response.data);//获取到一级网格点的信息
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                        }
                                    }
                                    break;
                                // case 'dbclick':
                                //     console.info(e);
                                //     break;
                                case 'rightclick':
                                    //右击进行详情信息的查询变更
                                    // 客户经理不能右击查看1级网格的信息
                                    if (yufp.session.roles[0].code == 'R0001') {
                                        this.$message.warning("您没有查看一级网格详情的权限！");
                                        return;
                                    }
                                    //获取网格id和等级 进行详细信息查询展示
                                    this.visible = true;
                                    var _this = this;
                                    for (var j = 0; j < this.markPolygonInfo.length; j++) {
                                        if (this.markPolygonInfo[j].fillOpacity == e.target.getFillOpacity()) {
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/oneLevelGridInfo',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '01'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    if (code == 0 && response.code == 0) {
                                                        console.info(response.data);
                                                        // console.info(_this.formatFix(response.data[0].depBal));
                                                        // console.info(_this.toPercent1(response.data[0].custCvr));
                                                        _this.gridName = response.data[0] ? response.data[0].gridName :'';
                                                        _this.depBal = response.data[0] ?  _this.formatFix(response.data[0].depBal) : '';
                                                        _this.gridCustNum = response.data[0] ?  response.data[0].gridCustNum :'';
                                                        _this.loanBal = response.data[0] ?  _this.formatFix(response.data[0].loanBal) :'';
                                                        _this.fincBal = response.data[0] ?  _this.formatFix(response.data[0].fincBal) : '';
                                                        _this.custCvr =response.data[0] ?  _this.toPercent1(response.data[0].custCvr) :'';
                                                        _this.custNum = response.data[0] ?  response.data[0].custNum :'';
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/oneLevelGridInfoCustNum',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '03'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    _this.custNumData=[];
                                                    _this.custNumDataValue=[];
                                                    _this.custNumDataValueAUM=[];
                                                    if (code == 0 && response.code == 0) {
                                                        for (let k = 0; k < response.data.length; k++) {
                                                            _this.custNumData.push(response.data[k].secondGridName);
                                                            _this.custNumDataValue.push(response.data[k].custNum);
                                                            _this.custNumDataValueAUM.push(response.data[k].aum);
                                                        }
                                                        var echart = echarts.init(document.getElementById('barOption1'));
                                                        var barOptionE = {
                                                            xAxis: {
                                                                type: 'category',
                                                                data: _this.custNumData //['网格一', '网格二', '网格三', '网格四']
                                                            },
                                                            yAxis: {
                                                                type: 'value',
                                                                scale: true
                                                            },
                                                            series: [{
                                                                data: _this.custNumDataValue, //[4123, 5012, 6399, 2301],
                                                                type: 'bar',
                                                                showBackground: true,
                                                                barWidth: 30,//柱图宽度
                                                                backgroundStyle: {
                                                                    color: 'rgba(180, 180, 180, 0.2)'
                                                                },
                                                                itemStyle: {
                                                                    normal: {
                                                                        color: function (params) {
                                                                            var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                                                                            return colorlist[params.dataIndex];
                                                                        }
                                                                    }
                                                                }
                                                            }]
                                                        };
                                                        echart.setOption(barOptionE);
                                                        var echartAUM = echarts.init(document.getElementById('barOptionAUM'));
                                                        var barOptionAUM = {
                                                            xAxis: {
                                                                type: 'category',
                                                                data: _this.custNumData
                                                            },
                                                            yAxis: {
                                                                type: 'value',
                                                                scale: true
                                                            },
                                                            series: [{
                                                                data: _this.custNumDataValueAUM,
                                                                type: 'bar',
                                                                showBackground: true,
                                                                barWidth: 40,//柱图宽度
                                                                backgroundStyle: {
                                                                    color: 'rgba(180, 180, 180, 0.2)'
                                                                },
                                                                itemStyle: {
                                                                    normal: {
                                                                        color: function (params) {
                                                                            var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                                                                            return colorlist[params.dataIndex];
                                                                        }
                                                                    }
                                                                },
                                                                markLine: {
                                                                    itemStyle: {
                                                                        normal: {
                                                                            color: '#FA8565',
                                                                            label: {
                                                                                formatter: '{b} {c}'
                                                                            }
                                                                        }
                                                                    },
                                                                    data: [
                                                                        {
                                                                            name: '目标值',
                                                                            yAxis: 8.5
                                                                        }
                                                                    ]
                                                                }
                                                            }]
                                                        };
                                                        echartAUM.setOption(barOptionAUM);
                                                        // console.info(_this.custNumData);
                                                        // console.info(_this.custNumDataValue);
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/queryOneLevelGridInfoCustNumChange',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '01'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    _this.custNumDataQs=[];
                                                    _this.custNumDataQsValue=[];
                                                    _this.custNumDataDepValue=[];
                                                    if (code == 0 && response.code == 0) {
                                                        for (let k = 0; k < response.data.length; k++) {
                                                            _this.custNumDataQs.push(response.data[k].etlDt);
                                                            _this.custNumDataQsValue.push(response.data[k].custNum);
                                                            _this.custNumDataDepValue.push(response.data[k].depBal);
                                                        }
                                                        var echart = echarts.init(document.getElementById('categoryOption'));
                                                        var categoryOptionE = {
                                                            tooltip: {
                                                                trigger: 'axis'
                                                            },
                                                            legend: {
                                                                data: ['平均数']
                                                            },
                                                            xAxis: {
                                                                type: 'category',
                                                                boundaryGap: false,
                                                                data: _this.custNumDataQs
                                                            },
                                                            yAxis: {
                                                                type: 'value'
                                                            },
                                                            series: [{
                                                                name: '平均值:',
                                                                data: _this.custNumDataQsValue,
                                                                type: 'line'
                                                            }]
                                                        };
                                                        echart.setOption(categoryOptionE);
                                                        var echartSh = echarts.init(document.getElementById('shadowOption'));
                                                        var shadowOption = {
                                                            tooltip: {
                                                                trigger: 'axis',
                                                                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                                                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                                                                }
                                                            },
                                                            // grid: {
                                                            //     left: '3%',
                                                            //     right: '4%',
                                                            //     bottom: '3%',
                                                            //     containLabel: true
                                                            // },
                                                            xAxis: [
                                                                {
                                                                    type: 'category',
                                                                    data: _this.custNumDataQs,
                                                                    axisTick: {
                                                                        alignWithLabel: true
                                                                    }
                                                                }
                                                            ],
                                                            yAxis: [
                                                                {
                                                                    type: 'value'
                                                                }
                                                            ],
                                                            series: [
                                                                {
                                                                    name: '平均值:',
                                                                    type: 'bar',
                                                                    barWidth: '60%',
                                                                    data: _this.custNumDataDepValue,
                                                                }
                                                            ]
                                                        };
                                                        echartSh.setOption(shadowOption);
                                                        // console.info(_this.custNumData);
                                                        // console.info(_this.custNumDataValue);
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                        }
                                    }
                                    console.info("+++++++++++++++++++=");
                                    console.info(yufp.session.roles[0].code);
                                    console.info(e.target.getFillOpacity());
                                    console.info(e);
                            }
                        });
                    }
                    for (let i = 0; i < moveEvts.length; i++) {
                        const event = moveEvts[i];
                        // for (let j = 1; j < overlays.length; j++) {
                        //     const overlay = overlays[j];
                        polygon.addEventListener(event, e => {
                            switch (event) {
                                case 'mouseover':
                                    polygon.setFillColor('#6f6cd8')
                                    break;
                                case 'mouseout':
                                    polygon.setFillColor('#fff');
                                    break;
                            }
                        });
                    }
                },
                //给二级多边形添加事件
                addListeTwo: function (polygon) {
                    // 批量绑定事件
                    var clickEvts = ['click'];
                    var moveEvts = ['mouseover', 'mouseout'];
                    // var overlays = [marker, polyline, polygon, circle];
                    var _this = this;
                    for (let i = 0; i < clickEvts.length; i++) {
                        const event = clickEvts[i];
                        // for (let j = 0; j < overlays.length; j++) {
                        //     const overlay = overlays[j];
                        polygon.addEventListener(event, e => {
                            switch (event) {
                                case 'click':
                                    //点击进行二级网格的基本信息查询展示
                                    console.info(e.target.getFillOpacity());
                                    this.visible = true;
                                    for (var j = 0; j < this.markPolygonInfo.length; j++) {
                                        if (this.markPolygonInfo[j].fillOpacity == e.target.getFillOpacity()) {
                                            console.info("点击进行二级网格的基本信息查询展示")
                                            //待表构建确认
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/twoLevelGridInfo',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '03'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    if (code == 0 && response.code == 0) {
                                                        console.info(response.data);
                                                        // console.info(_this.formatFix(response.data[0].depBal));
                                                        // console.info(_this.toPercent1(response.data[0].custCvr));
                                                        _this.gridName = response.data[0] ? response.data[0].secondGridName :'';
                                                        _this.depBal = response.data[0] ?  _this.formatFix(response.data[0].depBal) :'';
                                                        _this.gridCustNum = response.data[0] ?  response.data[0].gridCustNum :'';
                                                        _this.loanBal = response.data[0] ?  _this.formatFix(response.data[0].loanBal) :'';
                                                        _this.fincBal = response.data[0] ?  _this.formatFix(response.data[0].fincBal) :'';
                                                        _this.custCvr = response.data[0] ?  _this.toPercent1(response.data[0].custCvr) :'';
                                                        _this.custNum = response.data[0] ?  response.data[0].custNum :'';
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/twoLevelGridInfoCustNum',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '03'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    _this.custNumData=[];
                                                    _this.custNumDataValue=[];
                                                    _this.custNumDataValueAUM=[];
                                                    if (code == 0 && response.code == 0) {
                                                        for (let k = 0; k < response.data.length; k++) {
                                                            _this.custNumData.push(response.data[k].secondGridName);
                                                            _this.custNumDataValue.push(response.data[k].custNum);
                                                            _this.custNumDataValueAUM.push(response.data[k].aum);
                                                        }
                                                        var echart = echarts.init(document.getElementById('barOption1'));
                                                        var barOptionE = {
                                                            xAxis: {
                                                                type: 'category',
                                                                data: _this.custNumData //['网格一', '网格二', '网格三', '网格四']
                                                            },
                                                            yAxis: {
                                                                type: 'value',
                                                                scale: true
                                                            },
                                                            series: [{
                                                                data: _this.custNumDataValue, //[4123, 5012, 6399, 2301],
                                                                type: 'bar',
                                                                showBackground: true,
                                                                barWidth: 30,//柱图宽度
                                                                backgroundStyle: {
                                                                    color: 'rgba(180, 180, 180, 0.2)'
                                                                },
                                                                itemStyle: {
                                                                    normal: {
                                                                        color: function (params) {
                                                                            var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                                                                            return colorlist[params.dataIndex];
                                                                        }
                                                                    }
                                                                }
                                                            }]
                                                        };
                                                        echart.setOption(barOptionE);
                                                        var echartAUM = echarts.init(document.getElementById('barOptionAUM'));
                                                        var barOptionAUM = {
                                                            xAxis: {
                                                                type: 'category',
                                                                data: _this.custNumData
                                                            },
                                                            yAxis: {
                                                                type: 'value',
                                                                scale: true
                                                            },
                                                            series: [{
                                                                data: _this.custNumDataValueAUM,
                                                                type: 'bar',
                                                                showBackground: true,
                                                                barWidth: 40,//柱图宽度
                                                                backgroundStyle: {
                                                                    color: 'rgba(180, 180, 180, 0.2)'
                                                                },
                                                                itemStyle: {
                                                                    normal: {
                                                                        color: function (params) {
                                                                            var colorlist = ['#DA251D', '#E67716', '#FBC300', '#11440f', '#32585a', '#00ff77'];
                                                                            return colorlist[params.dataIndex];
                                                                        }
                                                                    }
                                                                },
                                                                markLine: {
                                                                    itemStyle: {
                                                                        normal: {
                                                                            color: '#FA8565',
                                                                            label: {
                                                                                formatter: '{b} {c}'
                                                                            }
                                                                        }
                                                                    },
                                                                    data: [
                                                                        {
                                                                            name: '目标值',
                                                                            yAxis: 8.5
                                                                        }
                                                                    ]
                                                                }
                                                            }]
                                                        };
                                                        echartAUM.setOption(barOptionAUM);
                                                        // console.info(_this.custNumData);
                                                        // console.info(_this.custNumDataValue);
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                            yufp.service.request({
                                                url: backend.msmFrontWebService + '/api/gridGeneral/queryTwoLevelGridInfoCustNumChange',
                                                method: 'get',
                                                data: {
                                                    condition: JSON.stringify({
                                                        id: this.markPolygonInfo[j].id,
                                                        level: '03'
                                                    })
                                                },
                                                callback: function (code, message, response) {
                                                    _this.custNumDataQs=[];
                                                    _this.custNumDataQsValue=[];
                                                    _this.custNumDataDepValue=[];
                                                    if (code == 0 && response.code == 0) {
                                                        for (let k = 0; k < response.data.length; k++) {
                                                            _this.custNumDataQs.push(response.data[k].etlDt);
                                                            _this.custNumDataQsValue.push(response.data[k].custNum);
                                                            _this.custNumDataDepValue.push(response.data[k].depBal);
                                                        }
                                                        var echart = echarts.init(document.getElementById('categoryOption'));
                                                        var categoryOptionE = {
                                                            tooltip: {
                                                                trigger: 'axis'
                                                            },
                                                            legend: {
                                                                data: ['平均数']
                                                            },
                                                            xAxis: {
                                                                type: 'category',
                                                                boundaryGap: false,
                                                                data: _this.custNumDataQs
                                                            },
                                                            yAxis: {
                                                                type: 'value'
                                                            },
                                                            series: [{
                                                                name: '平均值:',
                                                                data: _this.custNumDataQsValue,
                                                                type: 'line'
                                                            }]
                                                        };
                                                        echart.setOption(categoryOptionE);
                                                        var echartSh = echarts.init(document.getElementById('shadowOption'));
                                                        var shadowOption = {
                                                            tooltip: {
                                                                trigger: 'axis',
                                                                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                                                                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                                                                }
                                                            },
                                                            // grid: {
                                                            //     left: '3%',
                                                            //     right: '4%',
                                                            //     bottom: '3%',
                                                            //     containLabel: true
                                                            // },
                                                            xAxis: [
                                                                {
                                                                    type: 'category',
                                                                    data: _this.custNumDataQs,
                                                                    axisTick: {
                                                                        alignWithLabel: true
                                                                    }
                                                                }
                                                            ],
                                                            yAxis: [
                                                                {
                                                                    type: 'value'
                                                                }
                                                            ],
                                                            series: [
                                                                {
                                                                    name: '平均值:',
                                                                    type: 'bar',
                                                                    barWidth: '60%',
                                                                    data: _this.custNumDataDepValue,
                                                                }
                                                            ]
                                                        };
                                                        echartSh.setOption(shadowOption);
                                                        // console.info(_this.custNumData);
                                                        // console.info(_this.custNumDataValue);
                                                        console.info("成功");
                                                    } else {
                                                        console.info("失败");
                                                    }
                                                }
                                            });
                                        }
                                    }
                                    break;
                            }
                        });
                    }
                    for (let i = 0; i < moveEvts.length; i++) {
                        const event = moveEvts[i];
                        // for (let j = 1; j < overlays.length; j++) {
                        //     const overlay = overlays[j];
                        polygon.addEventListener(event, e => {
                            switch (event) {
                                case 'mouseover':
                                    polygon.setFillColor('#6f6cd8')
                                    break;
                                case 'mouseout':
                                    polygon.setFillColor('#fff');
                                    break;
                            }
                        });
                    }
                },
                //给二级多边形及建筑物点添加事件，二级网格添加点击事件，建筑物点添加点击事件
                addListeThird: function (marker) {
                    // 批量绑定事件
                    var clickEvts = ['click'];
                    // var moveEvts = ['mouseover', 'mouseout'];
                    // var overlays = [marker, polyline, polygon, circle];
                    var _this = this;
                    for (let i = 0; i < clickEvts.length; i++) {
                        const event = clickEvts[i];
                        // for (let j = 0; j < overlays.length; j++) {
                        //     const overlay = overlays[j];
                        marker.addEventListener(event, e => {
                            switch (event) {
                                case 'click':
                                    //点击进行二级网格的基本信息查询展示
                                    console.info("marker点击");
                                    break;
                            }
                        });
                    }
                    // for (let i = 0; i < moveEvts.length; i++) {
                    //     const event = moveEvts[i];
                    //     // for (let j = 1; j < overlays.length; j++) {
                    //     //     const overlay = overlays[j];
                    //     polygon.addEventListener(event, e => {
                    //         switch (event) {
                    //             case 'mouseover':
                    //                 polygon.setFillColor('#6f6cd8')
                    //                 break;
                    //             case 'mouseout':
                    //                 polygon.setFillColor('#fff');
                    //                 break;
                    //         }
                    //     });
                    // }
                },
                formatFix: function (a) {
                    return a.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
                },
                toPercent1: function (point) {
                    if (point == 0) {
                        return 0;
                    }
                    var str = Number(point * 100).toFixed();
                    str += "%";
                    return str;
                }
            }
        });
    };
    // 消息处理
    exports.onmessage = function (type, message) {

    };

    // page销毁时触发destroy方法
    exports.destroy = function (id, cite) {

    };
});
